//
//  JDNetworkTools.swift
//  JDWeiBo
//
//  Created by apple on 15/6/27.
//  Copyright © 2015年 apple. All rights reserved.
//

import UIKit
import AFNetworking

class JDNetworkTools: AFHTTPSessionManager {
    // 实例化一个单例对象
    private static let instance : JDNetworkTools = {
        
        // 定义 baseURL
        let urlString = "https://api.weibo.com/"
        
        let baseURL = NSURL(string: urlString)
        
        let tools = JDNetworkTools(baseURL: baseURL)
        
        tools.responseSerializer.acceptableContentTypes = NSSet(objects: "application/json", "text/json", "text/javascript", "text/plain") as! Set<String>
        
        return tools
    }()
    
    // 全局的访问方法
    class func sharedNetworkTools() -> JDNetworkTools {
        
        return instance
    }
}

// https://api.weibo.com/2/statuses/home_timeline.json?access_token=2.00PrDjJGQ1lJcE324cf3908ef24uqC